<template>
	<view class="bacolor" style="min-height: 100vh;">
		<view class="cui_moneybox" >
			<view class="cui_money">
				¥ <input type="number" v-model="money" style="width: 100px; font-size: 30px;padding: 0 10px;" />元
			</view>
			<view class="cui_totalmoney">
				当前{{totalmoney.now_money}}元
			</view>
			<view class="" style="margin-top: 100px;display: flex;justify-content: space-between;width: 100%;align-items: center;" @click="goyinhangka">
				<view class="yinhangcard" >
					<view class="carname" v-if="this.name == undefined">
						<text>请选择提现方式</text>
					</view>
					<view v-else class="carname">
						<text v-model="name">{{name}}</text>
						<text style="margin-top: 10px;" v-model="cardnum">{{cardnum}}</text>
					</view>
					
				</view>
				<view class="">
					<image src="/static/images/next.png" mode="widthFix" style="width: 20px;height: 20px;"></image>
				</view>
			</view>
		</view>



		<view class="btn" @click="totixian">
			<text>申请提现</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				view_class:{
					height:""
				},
				money:'',
				totalmoney:'',
				cardnum:'',
				name:''
			}
		},
		onNavigationBarButtonTap(e) {
			// console.log(e)
			if(e.float == "right"){
				uni.navigateTo({
					url:"/pages/setting/WithdrawalRecord"
				})
			}
		},
		onLoad:function(options){
			this.token = uni.getStorageSync("token")
			this.totalmoneys()
			console.log(options)
			console.log(options.item)
			this.name = options.name
			this.cardnum =options.item
			
			this.view_class.height=uni.getSystemInfoSync().windowHeight
			// console.log(this.view_class)
			
		},
		methods: {
			totalmoneys(){
				uni.request({
					url: this.G_base + '/api/user/balance',
					method: "GET",
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + this.token
					},
					success: (res) => {
						console.log(res)
						if(res.data.status ==200){
							this.totalmoney = res.data.data
						}
						
					},
				});
			},
			
			goyinhangka(){
				uni.navigateTo({
					// url:'/pages/tixian/minetixian/yinhanglist',
					url:'/pages/tixian/minetixian/tixianfangshi'
				})
			},
			totixian(){
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/extract/cash',
					data:{
						money:this.money,
						cardnum:this.cardnum
					},
					method: "POST",
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: (res) => {
						console.log(res)
						// this.money = res.data.data
						if(res.data.status == 200){
							uni.showToast({
								title:res.data.msg,
								icon:"none"
							})
							setTimeout(()=>{
								uni.redirectTo({
									url:'/pages/tixian/yinhangkajilv/yinhangkajilv'
								})
							},1000)
						}else{
							uni.showToast({
								title:res.data.msg,
								icon:"none"
							})
						}
					},
				});
			},
			gotixianjilu(){
				
			},
			goback(){
				uni.navigateBack({
					delta:1
				})
			},
			goxiugai(){
				uni.navigateTo({
					url:"../xiugaiyingangka/xiugaiyingangka"
				})
			}
		}
	}
</script>

<style>
	.btn text {
		color: #FFFFFF;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.btn {
		background: -webkit-linear-gradient(left,#a00000,#e10004,#a00000);
		/* background-image: radial-gradient(black, white, black);
		background: linear-gradient(90deg, red, white,red); */
		border-radius: 30px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 70px;
		margin-left: 50%;
		transform: translateX(-50%);
		width: 164px;
		height: 50px;
		line-height: 20px;
		text-align: center;
	}

	.carname {
		display: flex;
		flex-direction: column;
	}

	.yinhangcard {
		margin: 0 20px;
		align-items: center;
		display: flex;
		justify-content: space-between;
		color: rgba(16, 16, 16, 1);
		font-size: 16px;
		font-family: PingFangSC-regular;
	}

	.cui_totalmoney {
		position: absolute;
		right: 40px;
		top: 13%;
		color: #C0C0C0;
		font-size: 14px;
		text-align: left;
		font-family: PingFangSC-regular;
	}

	.cui_money {
		/* padding-top: 10px; */
		display: flex;
		justify-content: flex-start;
		align-items: center;
		position: absolute;
		left: 50px;
		top: 10%;
		color: rgba(16, 16, 16, 1);
		font-size: 30px;
		text-align: left;
		font-family: PingFangSC-regular;
	}

	.cui_moneybox {
		background-color: #FFFFFF;
		width: 90%;
		height: 180px;
		border-radius: 5px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 5%;
		margin-right: 5%;
		margin-top: 10%;

	}

	page{
		background-color: rgb(250,250,250);
	}

	.cui_title {
		padding-top: 10px;
		display: flex;
		justify-content: space-around;
		align-items: center;
	}
</style>
